﻿/***********************************************
  [className] QThreadBase
  [func]      线程基类
  [author]    syz
  [date]      2020/7/1 15:09
  [log]       初次建立
************************************************/
#ifndef THREADBASE_H
#define THREADBASE_H

#include <QObject>
#include <QThread>
#include <QTimer>

class QThreadBase : public QObject
{
    Q_OBJECT

public:
    QThreadBase();
    ~QThreadBase();

private:


public slots:

    //开始线程|nWaitTime>0时 代表需要延时启动线程
    void StartWorkThread(int nWaitTime = 0);

    //停止线程
    void StopWorkThread();

signals:
	//启动工作线程信号
	void sigStartWorkProc();

private slots:

    //工作线程
    virtual void slotWorkProc() = 0;

protected:

    QThread m_thread;
    bool m_bStopWorkThread;//停止线程标志

    //线程循环  nWaitTime|下次线程循环到来的时间，单位：毫秒(暂时未使用)
    void threadCirculate(int nWaitTime);

	//线程休眠，nWaitTime:ms
	void threadSleep(int nWaitTime);
};

#endif // THREADBASE_H
